/*
 * Copyright (C) 2011 Markus Junginger, greenrobot (http://greenrobot.de)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package de.greenrobot.daogenerator.gentest;

import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;

/**
 * Generates entities and DAOs for the example project DaoExample.
 * 
 * Run it as a Java application (not Android).
 * 
 * @author Markus
 */
public class ExampleDaoGeneratorZS
{

    /*
     * public static String SDPATH = Environment.getExternalStorageDirectory() +
     * "/etone/";
     */
    public static void main(String[] args) throws Exception
    {
        Schema schema = new Schema(1, "com.gesee.zyspps.db");
        schema.enableKeepSectionsByDefault();
        CmsPoints(schema);
        CmsDbNum(schema);
        CmsPointsName(schema);
        CmsPipelineField(schema);
        CmsFeature(schema);
        CmsLine(schema);
        CmsPicture(schema);
        CmsPipePoint(schema);
        CmsSpecialLine(schema);
        new DaoGenerator().generateAll(schema, "../../../MagnifyMap/src");
    }

    /**
     * 管点信息
     * 
     * @param schema
     */
    private static void CmsPoints(Schema schema)
    {
        Entity entity = schema.addEntity("CmsPoints");
        // entity.setHasKeepSections(true);
        entity.addIdProperty();
        entity.implementsSerializable();
        entity.addStringProperty("ExpNO"); // 管点编号
        entity.addStringProperty("WDeep");// 井底埋深
        entity.addStringProperty("PCode"); //小类
        entity.addStringProperty("Subsid");// 附属物
        entity.addStringProperty("Feature");// 特征
        entity.addIntProperty("MapNoNum"); // 管点编号小标
        entity.addStringProperty("Mtype");// 井盖规格
        entity.addStringProperty("Wcover");// 井盖材质
        entity.addStringProperty("Msize");// 井盖尺寸
        entity.addStringProperty("Wdepth");// 井筒深度
        entity.addStringProperty("Hsize");// 井室尺寸
        entity.addStringProperty("Sblock");// 淤堵情况
        entity.addDoubleProperty("Offset");// 管偏井编号
        entity.addStringProperty("RoadName");// 道路名称
        entity.addStringProperty("BCode");// 权属单位
        entity.addDoubleProperty("BDate");// 建设年代
        entity.addDoubleProperty("PAngle");// 符号旋转角度
        entity.addDoubleProperty("MapCode");// 图幅号
        entity.addDoubleProperty("Punit");// 探测单位
        entity.addDoubleProperty("Pdate");// 探测日期
        entity.addDoubleProperty("Ename");// 工程名称
        entity.addDoubleProperty("Aname");// 测区名称
        entity.addDoubleProperty("Street");// 街道名称
        entity.addDoubleProperty("Quarter");// 小区名称
        entity.addDoubleProperty("Community");// 社区名称
        entity.addDoubleProperty("Probe");// 探测人员
        entity.addDoubleProperty("D_X");// X坐标
        entity.addDoubleProperty("D_Y");// y坐标
        entity.addStringProperty("Remark");// 备注
        entity.addStringProperty("jslx");// 井室类型
        entity.addStringProperty("tcsss");// 探测时水深
        entity.addStringProperty("tcsns");// 探查时泥深
        entity.addStringProperty("jcjdj");// 检查井等级
        entity.addStringProperty("jcjzpbh");// 检查井照片编号
        entity.addStringProperty("json");// 存添加的字段的json 值
        entity.addStringProperty("teshu1");// 特殊1
        entity.addStringProperty("teshu2");// 特殊2
    }

    /**
     * 新建工程名字表
     * 
     * @param schema
     */
    private static void CmsDbNum(Schema schema)
    {
        Entity entity = schema.addEntity("CmsDbNum");
        // entity.setHasKeepSections(true);
        entity.addIdProperty();
        entity.implementsSerializable();
        entity.addStringProperty("dbName"); // db名字
    }

    /**
     * 管线类别
     * 
     * @param schema
     */
    private static void CmsPointsName(Schema schema)
    {
        Entity entity = schema.addEntity("CmsPointsName");
        // entity.setHasKeepSections(true);
        entity.addIdProperty();
        entity.implementsSerializable();
        entity.addStringProperty("subCode");
        entity.addStringProperty("subName");
        entity.addStringProperty("parCode");
        entity.addStringProperty("parName");
        entity.addStringProperty("pointsColor");
        entity.addStringProperty("buryType");
        entity.addStringProperty("remark");
        entity.addIntProperty("sort");
    }

    /**
     * 
     * @Title: CmsPipelineField
     * @Description: TODO(创建管线字段表)
     * @author cw
     * @param schema
     * @throws
     */
    private static void CmsPipelineField(Schema schema)
    {
        Entity entity = schema.addEntity("CmsPipelineField");
        // entity.setHasKeepSections(true);
        entity.addIdProperty();
        entity.implementsSerializable();
        entity.addStringProperty("filedName");
        entity.addStringProperty("showFiled");
        entity.addStringProperty("dataType");
        entity.addStringProperty("dataLength");
        entity.addStringProperty("location");
        entity.addStringProperty("notNull");
        entity.addStringProperty("remark");
        entity.addIntProperty("sort");
    }

    /**
     * 
     * @Title: CmsLine
     * @Description: TODO(创建管线表)
     * @author fujianxiong
     * @param schema
     * @throws
     */
    private static void CmsLine(Schema schema)
    {
        Entity entity = schema.addEntity("CmsLine");
        // entity.setHasKeepSections(true);
        entity.addIdProperty();
        entity.implementsSerializable();
        entity.addStringProperty("PipeLength");// 管线长度
        entity.addStringProperty("S_Point"); // 起始物探点号
        entity.addStringProperty("E_Point"); // 起始物探点号
        entity.addStringProperty("S_Deep");// 起始埋深
        entity.addStringProperty("E_Deep");// 终止埋深
        entity.addStringProperty("PCode");// 管线类型
        entity.addStringProperty("DType");// 埋设方式
        entity.addStringProperty("Material");// 材质
        entity.addStringProperty("DSize");// 管径或断面尺寸
        entity.addStringProperty("PD_S");// 套管或管沟尺寸
        entity.addStringProperty("Pressure");// 压力
        entity.addStringProperty("Voltage");// 电压
        entity.addStringProperty("Direction");// 流向
        entity.addStringProperty("Cable");// 电缆条数
        entity.addStringProperty("Hole");// 总孔数
        entity.addStringProperty("Uhole");// 已用孔数
        entity.addStringProperty("Belong");// 权属单位名称
        entity.addStringProperty("Bdate");// 建设年代
        entity.addStringProperty("Road");// 道路名称
        entity.addStringProperty("S_D");// 起点管偏
        entity.addStringProperty("E_D");// 终点管偏
        entity.addStringProperty("Street");// 所属街道
        entity.addStringProperty("Community");// 所属社区
        entity.addStringProperty("Quarter");// 所属小区
        entity.addStringProperty("Aname");// 测区名称
        entity.addStringProperty("Punit");// 探测单位
        entity.addStringProperty("Pdate");// 探测日期
        entity.addStringProperty("Ename");// 工程名称
        entity.addStringProperty("Probe");// 探测人员
        entity.addStringProperty("Remark");// 备注
        entity.addStringProperty("cableLines");// 电缆条数
        entity.addStringProperty("useHole");// 已用孔数
        entity.addStringProperty("totalHole");// 总孔数
        entity.addStringProperty("lxbh1");// 录像编号1
        entity.addStringProperty("lxbh2");// 录像编号2
        entity.addStringProperty("json");// 存添加的字段的json 值
        entity.addStringProperty("teshu1");// 特殊1
        entity.addStringProperty("teshu2");// 特殊2
    }

    /**
     * 
     * @Title: CmsFeature
     * @Description: TODO(特征)
     * @author cw
     * @param schema
     * @throws
     */
    private static void CmsFeature(Schema schema)
    {
        Entity entity = schema.addEntity("CmsFeature");
        // entity.setHasKeepSections(true);
        entity.addIdProperty();
        entity.implementsSerializable();
        entity.addStringProperty("subCodes");
        entity.addStringProperty("filedName");
        entity.addStringProperty("filedValue");
        entity.addStringProperty("encoded");
        entity.addStringProperty("alias");
        entity.addStringProperty("mark");
        entity.addStringProperty("code");
        entity.addStringProperty("remark");
        entity.addStringProperty("angle");
        entity.addIntProperty("sort");
    }

    /**
     * 
     * @Title: CmsPicture
     * @Description: TODO(附属物对应图片)
     * @author cw
     * @param schema
     * @throws
     */
    private static void CmsPicture(Schema schema)
    {
        Entity entity = schema.addEntity("CmsPicture");
        // entity.setHasKeepSections(true);
        entity.addIdProperty();
        entity.implementsSerializable();
        entity.addStringProperty("subCode");
        entity.addStringProperty("parCode");
        entity.addStringProperty("featureName");
        entity.addStringProperty("pictureName");
    }

    /**
     * 
     * @Title: CmsPipePoint
     * @Description: TODO(管沟点)
     * @author fujianxiong
     * @param schema
     * @throws
     */
    private static void CmsPipePoint(Schema schema)
    {
        Entity entity = schema.addEntity("CmsPipePoint");
        // entity.setHasKeepSections(true);
        entity.addIdProperty();
        entity.implementsSerializable();
        entity.addStringProperty("ExpNo");// 管沟点号
        entity.addStringProperty("PType");// 管线类型
        entity.addStringProperty("RoadName");// 道路名称
        entity.addStringProperty("Bdate");// 建设年代
        entity.addStringProperty("Mtype");// 井盖规格
        entity.addStringProperty("Wcover");// 井盖材质
        entity.addStringProperty("Msize");// 井盖尺寸
        entity.addStringProperty("Wdepth");// 井筒深度
        entity.addStringProperty("Hsize");// 井室尺寸
        entity.addStringProperty("Punit");// 探测单位
        entity.addStringProperty("Pdate");// 探测日期
        entity.addStringProperty("Ename");// 工程名称
        entity.addStringProperty("Aname");// 测区名称
        entity.addStringProperty("Street");// 街道名称
        entity.addStringProperty("Quarter");// 小区名称
        entity.addStringProperty("Community");// 社区名称
        entity.addStringProperty("Probe");// 探测人员
        entity.addStringProperty("D_X");// 点号X坐标
        entity.addStringProperty("D_Y");// 点号Y坐标
        entity.addStringProperty("Sblock");// 淤堵情况
        entity.addStringProperty("Remark");// 备注
    }
    
    private static void CmsSpecialLine(Schema schema)
    {
        Entity entity = schema.addEntity("CmsSpecialLine");
        // entity.setHasKeepSections(true);
        entity.addIdProperty();
        entity.implementsSerializable();
        entity.addStringProperty("ExpNO");
        entity.addStringProperty("PCode");
        entity.addDoubleProperty("start_X");
        entity.addDoubleProperty("start_Y");
        entity.addDoubleProperty("stop_X");
        entity.addDoubleProperty("stop_Y");
    }
}
